package xuexi;

class Item{
    private long iid;
    private Subitem subitem [];

    public Subitem[] getSubitem() {
        return subitem;
    }

    public void setSubitem(Subitem[] subitem) {
        this.subitem = subitem;
    }

    private String title;

    public String getInofo(){
        return "[分类信息]  iid:"+this.iid + "      title: "+ this.title;
    }
    public Item(long iid, String title) {
        this.iid = iid;
        this.title = title;
    }

    public void setIid(long iid) {
        this.iid = iid;
    }

    public void setTitle(String title) {
        this.title = title;
    }

    public long getIid() {
        return iid;
    }

    public String getTitle() {
        return title;
    }
}
class Subitem{
    private long sid;
    private Item item;
    private String title;

    public Item getItem() {
        return item;
    }

    public void setItem(Item item) {
        this.item = item;
    }

    public String getInofo(){
        return "[子分类信息] sid:"+this.sid + "     title: "+ this.title;
    }
    public Subitem(long sid, String title) {
        this.sid = sid;
        this.title = title;
    }

    public long getSid() {
        return sid;
    }

    public void setSid(long sid) {
        this.sid = sid;
    }

    public String getTitle() {
        return title;
    }

    public void setTitle(String title) {
        this.title = title;
    }
}
public class oneandduo {
    public  static void main(String[] args){
    Item item=new Item(1L,"编程");
    Subitem subitem[]=new Subitem[]{
            new Subitem(1002L,"计算机网络"),
            new Subitem(1003,"网络编程")
    };
    item.setSubitem(subitem);
    for (int i=0;i<subitem.length;i++){
        subitem[i].setItem(item);
    }
    System.out.println(item.getInofo());
    for (int j=0;j<item.getSubitem().length;j++){
        System.out.println("\t|-" +item.getSubitem()[j].getInofo());
    }
    }
}
